import { createRouter, createWebHistory } from 'vue-router';
import UserHome from '../views/UserHome.vue';
import UserArticles from '../views/UserArticles.vue';
import UserLife from '../views/UserLife.vue';
import UserAboutMe from '../views/UserAboutMe.vue';
import ArticleView from '@/views/ArticleView.vue';

const routes = [
  {
    path: '/',
    name: 'userHome',
    component: UserHome
  },
  {
    path: '/article/:filename',
    name: 'article',
    component: ArticleView,
    props: true // 允许组件接收路由参数作为props
  },
  {
    path: '/userArticles',
    name: 'UserArticles',
    component: UserArticles
  },
  {
    path: '/userLife',
    name: 'userLife',
    component: UserLife
  },
  {
    path: '/userAboutMe',
    name: 'UserAboutMe',
    component: UserAboutMe
  },
];

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes,
});

export default router;

